package com.zwy.fornote.util;
/**
 *统一定义controller返回的数据格式
 *
 * @author zhuyi 1205242
 * @version AjaxResult 2021/3/10 20:02
 */
public class AjaxResult {
    private int code;
    private String msg;
    private Object data;
    private String errorCode;

    public AjaxResult() {
    }

    public AjaxResult(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }


    public static AjaxResult ok(Object data) {
        return new AjaxResult(200, "SUCCESS", data);
    }

    public static AjaxResult fail(int code, Object data) {
        return new AjaxResult(code,"FAIL", data);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }
}

